<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ajax</title>
<script type="text/javascript" src="/demo/ajax/jquery.js"></script>
<script type="text/javascript"> 
function getLabelsGet(){
	$.ajax({
	    url:'/demo/jsonajax',
	    type:'POST', //GET
	    async:true,    //或false,是否异步
	    data:{name:'yang',age:25},
	    timeout:5000,    //超时时间
	    dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
	    success:function(data){
	        alert(data);
	        alert(data[0].id);
	    },
	    error:function(){
	        alert('错误')
	    }
	});
}
</script>
</head>
<body>
<input type="text" id="id" onchange="getLabelsGet()">
</body>
</html>